package com.lsh.oms.core.service.aftersale.impl;

import com.lsh.oms.core.service.aftersale.IAfterSalesService;

/**
 *
 * @author xuzhan
 * @date 16/10/10
 */
public abstract class AbstractAfterSales<T> implements IAfterSalesService {
    /**
     * 插入
     * @param vo
     */
    public abstract void insert(T vo);

    /**
     * 修改
     * @param vo
     */
    public abstract void update(T vo);

    /**
     * 查询
     * @param vo
     * @return
     */
    public abstract T queryVoByOrdercode(T vo);

    @Override
    public void handleBussiness(String json, int type) throws Exception {
        T obj = parse(json);
        switch (type) {
            case 1:
                this.insert(obj);
                break;
            case 2:
                this.update(obj);
                break;

        }
    }

    @Override
    public T handleBussiness(String json) throws Exception {
        T obj = parse(json);
        T result = this.queryVoByOrdercode(obj);
        return result;
    }

    public abstract T parse(String json) throws Exception;

    public abstract Integer updateDel(T oas);
}
